package com.example.clouduser.web;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

@RestController
public class userAction {

    @RequestMapping("user")
    public String user(HttpServletRequest request){
        int port = request.getServerPort();
        return "user :" + port;
    }

    @Resource
    RestTemplate restTemplate;

    @RequestMapping("toOrder")
    String toOrder(){
        String url = "http://cloud-order/order";
        String forObject = restTemplate.getForObject(url, String.class);
        return forObject;
    }
}
